<?php
//上面这个也是有效的，和下面那个没有注释的，区别在于一个是需要数组，一个是需要json
/*$ACCESS_TOKEN ="27_bPbndv3ocKBZWXHPT_IVkwvngOTDNZDWPenup_xfW58T7Ft-jNp9fSAX_0w4Xb7HuZI9XtalP6iethjaXp6ugH72lhbpm03Uix6VtWvNC-GrtsPW4PjSLs7UmSNNEcECBJdn48oOS0J2f5XPJIEaAIAYXT";
$Menu["button"][] = array(
						"type"=>"view",
						"name"=>"Menu_Name",
						"url"=>"https://www.baidu.com/"
					);
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".$ACCESS_TOKEN);
		curl_setopt($ch, CURLOPT_POST, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
		//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//		curl_redir_exec($ch);
		curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($Menu,JSON_UNESCAPED_UNICODE));
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_HEADER, 0);		
		$return = json_decode(curl_exec($ch),true);
echo "<pre>";
print_r($return);
echo "</pre>";*/


$ACCESS_TOKEN ="27_bPbndv3ocKBZWXHPT_IVkwvngOTDNZDWPenup_xfW58T7Ft-jNp9fSAX_0w4Xb7HuZI9XtalP6iethjaXp6ugH72lhbpm03Uix6VtWvNC-GrtsPW4PjSLs7UmSNNEcECBJdn48oOS0J2f5XPJIEaAIAYXT";
$j_en = '
{
    "button": [
        {
            "type": "click", 
            "name": "今日歌曲", 
            "key": "V1001_TODAY_MUSIC"
        }, 
        {
            "name": "菜单项", 
            "sub_button": [
                {
                    "type": "view", 
                    "name": "搜索", 
                    "url": "http://www.soso.com/"
                }, 
                {
                    "type": "click", 
                    "name": "赞一下我们", 
                    "key": "V1001_GOOD"
                }
            ]
        }
    ]
}
';
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".$ACCESS_TOKEN);
		curl_setopt($ch, CURLOPT_POST, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
		//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//		curl_redir_exec($ch);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $j_en);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_HEADER, 0);		
		$return = json_decode(curl_exec($ch),true);
echo "<pre>";
print_r($return);
echo "</pre>";

curl_close($ch);




?>